package com.qf.fronted.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 前台用户
 */
@TableName("user")  // 当java实体对象与数据库表名不符合的时候，需要通过该属性来指定
public class User {
    // 标识该字段映射到数据库的主键, 针对数据库自增长，需要将 type 设置为 IdType.AUTO
    @TableId(type = IdType.AUTO)
    private Integer id;

    @TableField("u_name")
    private String name;

    @TableField("u_password")
    private String password;

    @TableField("u_email")
    private String email;

    @TableField("u_sex")
    private String sex;

    @TableField("u_status")
    private Integer status; //激活状态

    @TableField("u_phone")
    private String phone;

    // @TableField是数据库的字段名
    @TableField("u_register_date")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date registerDate;

    @TableField("u_balance")
    private BigDecimal balance;

    public User(Integer id, String name, String password, String email, String sex, Integer status, String phone, Date registerDate, BigDecimal balance) {
        this.id = id;
        this.name = name;
        this.password = password;
        this.email = email;
        this.sex = sex;
        this.status = status;
        this.phone = phone;
        this.registerDate = registerDate;
        this.balance = balance;
    }

    public User(String name, String password, String email, String phone, String sex) {
        this.name = name;
        this.password = password;
        this.email = email;
        this.phone = phone;
        this.sex = sex;
    }

    public User() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }
}
